package com.gcstorage.tvdev.view.pop

import android.content.Context
import android.view.View
import com.gcstorage.tvdev.R
import com.lxj.xpopup.core.CenterPopupView

/**
 * 提醒切换账号
 */
class NoticePopupWindow(context: Context, linster: OnClickQuiteLister) :
    CenterPopupView(context) {
    override fun getImplLayoutId(): Int {
        return R.layout.notice_popup
    }

    private var quite: OnClickQuiteLister? = null

    init {
        quite = linster
    }

    override fun onCreate() {
        super.onCreate()
        val spCancel = findViewById<View>(R.id.sp_cancel)
        val spOk = findViewById<View>(R.id.sp_ok)
//        spCancel.requestFocus()

        //取消
        spCancel.setOnClickListener {
            quite?.switch()
            dismiss()
        }
        //确定
        spOk.setOnClickListener {
            quite?.quite()
            dismiss()
        }


        spCancel.setOnFocusChangeListener { v, hasFocus ->
//            if (hasFocus) {
//                spCancel.shapeBuilder?.setShapeStrokeColor(R.color.color_6EF7A8)
//                spCancel.shapeBuilder?.setShapeSolidColor(R.color.white)
//                spCancel.setTextColor(context.resources.getColor(R.color.color_6EF7A8))
//            } else {
//                spCancel.shapeBuilder?.setShapeStrokeColor(R.color.transparent)
//                spCancel.shapeBuilder?.setShapeSolidColor(R.color.color_D8D8D8)
//                spCancel.setTextColor(context.resources.getColor(R.color.white))
//            }

        }
        spOk.setOnFocusChangeListener { v, hasFocus ->
//            if (hasFocus) {
//                spOk.shapeBuilder?.setShapeStrokeColor(R.color.color_6EF7A8)
//                spOk.shapeBuilder?.setShapeSolidColor(R.color.white)
//                spOk.setTextColor(context.resources.getColor(R.color.color_6EF7A8))
//            } else {
//                spOk.shapeBuilder?.setShapeStrokeColor(R.color.transparent)
//                spOk.shapeBuilder?.setShapeSolidColor(R.color.color_D8D8D8)
//                spOk.setTextColor(context.resources.getColor(R.color.white))
//            }
        }
    }

    interface OnClickQuiteLister {
        fun quite()
        fun switch()
    }

}